from PIL import Image, ImageFilter

def apply_filter(img: Image.Image, filter_type: str) -> Image.Image:
    if filter_type == "BLUR":
        return img.filter(ImageFilter.BLUR)
    elif filter_type == "CONTOUR":
        return img.filter(ImageFilter.CONTOUR)
    # 可扩展更多滤镜
    return img